package com.security.dataprocess.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.security.dataprocess.mapper.MapCamerainfoMapper;
import com.security.dataprocess.model.MapCamerainfo;
import com.security.dataprocess.service.IMapCamerainfoService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author H
 * @since 2023-02-01
 */
@Service
@DS("mysql5")
public class MapCamerainfoServiceImpl extends ServiceImpl<MapCamerainfoMapper, MapCamerainfo> implements IMapCamerainfoService {

    @Override
    public IPage<MapCamerainfo> findListByPage(Integer page, Integer pageCount){
        IPage<MapCamerainfo> wherePage = new Page<>(page, pageCount);
        MapCamerainfo where = new MapCamerainfo();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(MapCamerainfo mapCamerainfo){
        return baseMapper.insert(mapCamerainfo);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(MapCamerainfo mapCamerainfo){
        return baseMapper.updateById(mapCamerainfo);
    }

    @Override
    public MapCamerainfo findById(Long id){
        return  baseMapper.selectById(id);
    }
}
